package com.cbg.archives.service.impl;

import com.cbg.archives.entity.EsArchivesModularCol;
import com.cbg.archives.repository.IEsArchivesModularColRepository;
import com.cbg.archives.service.IEsArchivesModularColService;
import com.cbg.dto.SelectedColListDTO;
import com.shuyuwl.core.enums.StatusEnum;
import com.shuyuwl.core.exception.SymServiceException;
import com.shuyuwl.core.service.impl.DaoServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 档案分类模块展示列 serviceImpl
 *
 * @author wangjuzheng
 * @since 2019-10-16
 */
@Service
@Transactional(rollbackFor = SymServiceException.class)
public class EsArchivesModularColServiceImpl extends DaoServiceImpl<EsArchivesModularCol, Long, IEsArchivesModularColRepository> implements IEsArchivesModularColService {

    @Resource
    private IEsArchivesModularColRepository esArchivesModularColRepository;

    @Override
    public void deleteByModularId(Long modularId, Byte status) {
        esArchivesModularColRepository.deleteByModularId(modularId, status);
    }

    @Override
    public List<SelectedColListDTO> selectedModular(Long modularId) {
        return esArchivesModularColRepository.selectedModular(modularId, StatusEnum.DELETE.getCode(), StatusEnum.OK.getCode());
    }

    @Override
    public EsArchivesModularCol findById(Long id) {
        return esArchivesModularColRepository.getEsArchivesModularCol(id, StatusEnum.DELETE.getCode(), StatusEnum.OK.getCode());
    }
}
